package c.c.a;

import com.huawei.hms.adapter.internal.CommonCode.MapKey;

public class r {
    public static final String[] a = new String[]{"ab_version", "device_brand", "language", "os_api", MapKey.HAS_RESOLUTION, "google_aid", "build_serial", "carrier", "install_id", "package", "app_version", "device_model", "udid", "density_dpi", "aliyun_uuid", "mcc_mnc", "sim_region", "ab_client", "ab_group", "ab_feature", "device_id", "openudid", "clientudid", "aid"};
    public static final String[] b = new String[]{"ab_version", "device_brand", "language", "os_api", MapKey.HAS_RESOLUTION, "google_aid", "build_serial", "carrier", "iid", "app_name", "version_name", "device_type", "uuid", "dpi", "aliyun_uuid", "mcc_mnc", "sim_region", "ab_client", "ab_group", "ab_feature", "device_id", "openudid", "clientudid", "aid"};

    /* JADX WARNING: Removed duplicated region for block: B:103:0x01ad A:{SYNTHETIC} */
    /* JADX WARNING: Removed duplicated region for block: B:94:0x01a8  */
    public static java.lang.String a(android.content.Context r7, org.json.JSONObject r8, java.lang.String r9, boolean r10, com.bytedance.embedapplog.IAppParam r11) {
        /*
        r0 = a;
        r1 = android.text.TextUtils.isEmpty(r9);
        if (r1 == 0) goto L_0x0009;
    L_0x0008:
        return r9;
    L_0x0009:
        r1 = new java.util.HashMap;
        r2 = r0.length;
        r3 = 10;
        r2 = r2 + r3;
        r1.<init>(r2);
        r2 = 0;
        r4 = 0;
    L_0x0014:
        r5 = r0.length;
        r6 = 0;
        if (r4 >= r5) goto L_0x002e;
    L_0x0018:
        r5 = r0[r4];
        r5 = r8.optString(r5, r6);
        r6 = android.text.TextUtils.isEmpty(r5);
        if (r6 != 0) goto L_0x002b;
    L_0x0024:
        r6 = b;
        r6 = r6[r4];
        r1.put(r6, r5);
    L_0x002b:
        r4 = r4 + 1;
        goto L_0x0014;
    L_0x002e:
        if (r11 == 0) goto L_0x0037;
    L_0x0030:
        r11 = r11.getAppSSIDs(r7);	 Catch:{ Exception -> 0x0035 }
        goto L_0x0038;
    L_0x0035:
        r11 = move-exception;
        goto L_0x0051;
    L_0x0037:
        r11 = r6;
    L_0x0038:
        r0 = c.c.a.n0.a(r7);	 Catch:{ Exception -> 0x0035 }
        if (r0 == 0) goto L_0x0048;
    L_0x003e:
        r4 = ":push";
        r0 = r0.endsWith(r4);	 Catch:{ Exception -> 0x0035 }
        if (r0 == 0) goto L_0x0048;
    L_0x0046:
        r0 = 1;
        goto L_0x0049;
    L_0x0048:
        r0 = 0;
    L_0x0049:
        if (r0 == 0) goto L_0x0054;
    L_0x004b:
        if (r11 == 0) goto L_0x0054;
    L_0x004d:
        r1.putAll(r11);	 Catch:{ Exception -> 0x0035 }
        goto L_0x0054;
    L_0x0051:
        c.c.a.m0.b(r11);
    L_0x0054:
        r11 = com.bytedance.embedapplog.AppLog.getExtraParams();	 Catch:{ Exception -> 0x006a }
        if (r11 != 0) goto L_0x005c;
    L_0x005a:
        r11 = r6;
        goto L_0x0064;
    L_0x005c:
        r11 = com.bytedance.embedapplog.AppLog.getExtraParams();	 Catch:{ Exception -> 0x006a }
        r11 = r11.getExtraParams();	 Catch:{ Exception -> 0x006a }
    L_0x0064:
        if (r11 == 0) goto L_0x006e;
    L_0x0066:
        r1.putAll(r11);	 Catch:{ Exception -> 0x006a }
        goto L_0x006e;
    L_0x006a:
        r11 = move-exception;
        c.c.a.m0.b(r11);
    L_0x006e:
        r11 = com.bytedance.embedapplog.AppLog.sCustomNetParams;
        r11 = r11.size();
        if (r11 <= 0) goto L_0x007b;
    L_0x0076:
        r11 = com.bytedance.embedapplog.AppLog.sCustomNetParams;
        r1.putAll(r11);
    L_0x007b:
        if (r10 == 0) goto L_0x0084;
    L_0x007d:
        r10 = "ssmix";
        r11 = "a";
        r1.put(r10, r11);
    L_0x0084:
        r7 = b.i.b.f.y(r7);
        r10 = android.text.TextUtils.isEmpty(r7);
        if (r10 != 0) goto L_0x0093;
    L_0x008e:
        r10 = "ac";
        r1.put(r10, r7);
    L_0x0093:
        r7 = "";
        r10 = "tweaked_channel";
        r10 = com.bytedance.embedapplog.AppLog.getHeaderValue(r10, r7);
        r10 = (java.lang.String) r10;
        r11 = android.text.TextUtils.isEmpty(r10);
        r0 = "channel";
        if (r11 == 0) goto L_0x00ab;
    L_0x00a5:
        r10 = com.bytedance.embedapplog.AppLog.getHeaderValue(r0, r7);
        r10 = (java.lang.String) r10;
    L_0x00ab:
        r11 = android.text.TextUtils.isEmpty(r10);
        if (r11 != 0) goto L_0x00b4;
    L_0x00b1:
        r1.put(r0, r10);
    L_0x00b4:
        r10 = "os_version";
        r11 = r8.optString(r10, r6);
        if (r11 == 0) goto L_0x00c6;
    L_0x00bc:
        r0 = r11.length();
        if (r0 <= r3) goto L_0x00c6;
    L_0x00c2:
        r11 = r11.substring(r2, r3);
    L_0x00c6:
        r1.put(r10, r11);
        r10 = java.lang.System.currentTimeMillis();
        r10 = java.lang.String.valueOf(r10);
        r11 = "_rticket";
        r1.put(r11, r10);
        r10 = "device_platform";
        r11 = "android";
        r1.put(r10, r11);
        r10 = -1;
        r11 = java.lang.Integer.valueOf(r10);
        r0 = "version_code";
        r11 = com.bytedance.embedapplog.AppLog.getHeaderValue(r0, r11);
        r11 = (java.lang.Integer) r11;
        r11 = r11.intValue();
        if (r11 == r10) goto L_0x00f7;
    L_0x00f0:
        r11 = java.lang.String.valueOf(r11);
        r1.put(r0, r11);
    L_0x00f7:
        r11 = java.lang.Integer.valueOf(r10);
        r0 = "manifest_version_code";
        r11 = com.bytedance.embedapplog.AppLog.getHeaderValue(r0, r11);
        r11 = (java.lang.Integer) r11;
        r11 = r11.intValue();
        if (r11 == r10) goto L_0x0110;
    L_0x0109:
        r11 = java.lang.String.valueOf(r11);
        r1.put(r0, r11);
    L_0x0110:
        r11 = java.lang.Integer.valueOf(r10);
        r0 = "update_version_code";
        r11 = com.bytedance.embedapplog.AppLog.getHeaderValue(r0, r11);
        r11 = (java.lang.Integer) r11;
        r11 = r11.intValue();
        if (r11 == r10) goto L_0x0129;
    L_0x0122:
        r10 = java.lang.String.valueOf(r11);
        r1.put(r0, r10);
    L_0x0129:
        r10 = "oaid";
        r11 = r8.optJSONObject(r10);
        r0 = c.c.a.t0.a;
        if (r11 == 0) goto L_0x0139;
    L_0x0133:
        r0 = "id";
        r6 = r11.optString(r0, r6);
    L_0x0139:
        r11 = android.text.TextUtils.isEmpty(r6);
        if (r11 != 0) goto L_0x0142;
    L_0x013f:
        r1.put(r10, r6);
    L_0x0142:
        r10 = "cdid";
        r8 = r8.optString(r10);
        r11 = android.text.TextUtils.isEmpty(r8);
        if (r11 != 0) goto L_0x0151;
    L_0x014e:
        r1.put(r10, r8);
    L_0x0151:
        r8 = "/";
        r10 = r9.endsWith(r8);
        if (r10 != 0) goto L_0x015d;
    L_0x0159:
        r9 = c.b.a.a.a.D(r9, r8);
    L_0x015d:
        r8 = c.b.a.a.a.g(r9);
        r10 = 63;
        r9 = r9.indexOf(r10);
        if (r9 >= 0) goto L_0x016a;
    L_0x0169:
        goto L_0x016c;
    L_0x016a:
        r10 = 38;
    L_0x016c:
        r8.append(r10);
        r8 = r8.toString();
        r9 = "UTF-8";
        r10 = new java.lang.StringBuilder;
        r10.<init>(r8);
        r8 = r1.keySet();
        r8 = r8.iterator();
    L_0x0182:
        r11 = r8.hasNext();
        if (r11 == 0) goto L_0x01b9;
    L_0x0188:
        r11 = r8.next();
        r11 = (java.lang.String) r11;
        r0 = java.net.URLEncoder.encode(r11, r9);	 Catch:{ UnsupportedEncodingException -> 0x0193 }
        goto L_0x0194;
    L_0x0193:
        r0 = r7;
    L_0x0194:
        r11 = r1.get(r11);
        r11 = (java.lang.String) r11;
        if (r11 == 0) goto L_0x01a1;
    L_0x019c:
        r11 = java.net.URLEncoder.encode(r11, r9);	 Catch:{ UnsupportedEncodingException -> 0x01a1 }
        goto L_0x01a2;
    L_0x01a1:
        r11 = r7;
    L_0x01a2:
        r2 = r10.length();
        if (r2 <= 0) goto L_0x01ad;
    L_0x01a8:
        r2 = "&";
        r10.append(r2);
    L_0x01ad:
        r10.append(r0);
        r0 = "=";
        r10.append(r0);
        r10.append(r11);
        goto L_0x0182;
    L_0x01b9:
        r7 = r10.toString();
        return r7;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.c.a.r.a(android.content.Context, org.json.JSONObject, java.lang.String, boolean, com.bytedance.embedapplog.IAppParam):java.lang.String");
    }
}
